<?php
namespace home\model;

use home\model\Model;

class TargetModel extends Model{
    /**
     * 获取博客 id 的标签
     */
    public function getTarget($params){
        $sql = 'SELECT blog_target.target FROM blog_target WHERE blog_id =:id AND state = 1 ';
        return $this->p_queryAll($sql,array('id'=>$params['id']));
    }
    /**
     * 查询热门标签
     */
    public function queryTarget(){
        $sql = 'SELECT blog_target.id,blog_target.target,COUNT(*) AS COUNT FROM blog_target GROUP BY target ORDER BY COUNT DESC LIMIT 0,10';
        return $this->queryAll($sql);
    }
}